import {IPlugIn} from "../../textEditor/ToolBarStrategy";

export default class Submit implements IPlugIn{

    private readonly _title:string = '提交';
    private upload:any;

    constructor(){
    }


    get title(): string {
        return this._title;
    }

    /**
     * only support API
     * example:
     * callBack:(data:any)=> API.post(url,data)
     * */
    settingUp(callBack:(data:any)=>any){
        this.upload = callBack;
    }


    execute(data:any){
        if(data===undefined){
            throw 'data is undefined;'
        }
        this.upload(data);
    }

}